package com.example.qxfw.nyqx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.qxfw.common.entity.ny.Quhuatu;
import com.example.qxfw.nyqx.mapper.QuhuatuMapper;
import com.example.qxfw.nyqx.service.QuhuatuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuhuatuServiceImpl implements QuhuatuService {

    @Autowired
    private QuhuatuMapper quhuatuMapper;

    @Override
    public List<String> getLayerName(String qhClass) {
        return quhuatuMapper.selectLayerName(qhClass);
    }

    @Override
    public List<Quhuatu> getList1(String qhClass, String layerType, String layerName) {
        return quhuatuMapper.selectList(Wrappers.<Quhuatu>lambdaQuery()
                .eq(Quhuatu::getQh_class,qhClass)
                .eq(Quhuatu::getLayer_type,layerType)
                .eq(Quhuatu::getLayer_name,layerName));
    }

    @Override
    public List<Quhuatu> getList1(String qhClass) {
        return quhuatuMapper.selectList(Wrappers.<Quhuatu>lambdaQuery().eq(Quhuatu::getQh_class,qhClass));
    }

    @Override
    public Integer update(Quhuatu quhuatu) {
        return quhuatuMapper.update(quhuatu,Wrappers.<Quhuatu>lambdaUpdate()
                .eq(Quhuatu::getQh_class,quhuatu.getQh_class())
                .eq(Quhuatu::getLayer_type,quhuatu.getLayer_type())
                .eq(Quhuatu::getLayer_name,quhuatu.getLayer_name()));
    }

    @Override
    public Integer save(Quhuatu quhuatu) {
        return quhuatuMapper.insert(quhuatu);
    }
}
